INSTRUCTIONS:

  • Follow the instructions on the stage to complete this interactive learning activity.
  • Look out for key terms marked with a ★!
  • Sometimes you will have to complete a task on the stage to continue. Pay attention!
  • At the end of the activity click Submit and Next to move on!

To navigate the page using the TAB key, first press ESC to exit the code editor.

import codesters import random from codesters.demo import Demo from codesters import Text # Set constants stage_height = float(stage.get_stage_height()) stage_width = float(stage.get_stage_width()) offstage_below = -1000 # Use as y value to create objects below the stage wait_time = 1 # Create Demo instance demo = Demo() # Set up stage stage.auto_cache_off() stage.set_background_color("black") stage.disable_floor() chars = [] for counter in range(60): x = random.randint(-550, 550) binary = codesters.Text(chr(random.randint(33, 255)), x, 300, "green") binary.set_y_speed(random.randint(-3, -1)) binary.set_physics_on() binary.set_opacity(random.random()) chars.append(binary) def interval(): for char in chars: if char.get_y() <= -(stage_height/2): char.go_to(random.randint(-550, 550), 310) char.set_y_speed(random.randint(-3, -1)) # char.set_opacity(random.randint(1,10)/10) stage.event_interval(interval, 0.05) # stage.set_background_color("#fff7fd") lesson_title = Text("Cybersecurity: Introduction", 0, 200, "white") lesson_title.set_text_width(800) lesson_title.set_text_size(40) activity_title = Text("Cybersecurity Systems", 0, 150, "white") activity_title.set_text_width(600) activity_title.set_text_size(30) stage.wait(wait_time*1) # guide = demo.create_sprite_off_screen("robot2", -stage_width/2-50, -175, 1) guide = demo.create_sprite_off_screen("person20", -stage_width/2-50, -150, 1) guide.move_forward(stage_width/2+50) demo.continue_action() stage.remove_sprite(lesson_title) stage.remove_sprite(activity_title) guide.say("We have defined cybersecurity as the way we approach building systems we can trust...", 0, "white", 20) stage.wait(wait_time*2) text = u"★" + " Cybersecurity is all about building secure computer systems that we can trust! " cyber_def = demo.animate_typing_text(text, -stage_width/3-100, 225, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time*1) demo.continue_action() guide.say("And we've spoken about systems and systems thinking!", 0, "white", 20) text = u"★" + " A system is a group of parts that work together as a whole " systems_def = demo.animate_typing_text(text, -stage_width/3-100, 185, align="left", font_size=25, color = "white", cursor_wait = False) stage.wait(wait_time*1) demo.continue_action() guide.say("What are some parts of the cybersecurity system?", 0, "white", 20) stage.wait(wait_time*2) demo.continue_action() guide.say("") guide.move_right(300) chip_trace = codesters.Sprite("gold_chip_trace") chip_trace.hide() chip_trace.set_width(1088) chip_trace.set_height(612) # Create gears with aligned text # gear_back = codesters.Rectangle(-stage_width/4+40, -50, 425, 300, "lightgreen") # gears = demo.create_sprite_off_screen("cogs_324", -stage_width/4-50, -50, 1) gears = demo.create_sprite_off_screen("green_cogs_783", -stage_width/4-50, -50, 1.4) security = codesters.Text("Security", -stage_width/4+20, 50, "white") security.set_text_font("consolas") comp_systems = codesters.Text("Computing Systems", -stage_width/4+150, -50, "white") comp_systems.set_text_font("consolas") dig_cit = codesters.Text("Digital Citizenship", -stage_width/4+75, -150, "white") dig_cit.set_text_font("consolas") # demo.continue_action() guide.say("Click each word to learn more\nabout that part of cybersecurity!", 0, "white", 20) guide.set_say_background("lightgreen", .5) # Add transparent overlays to the text to make clicking easier security_overlay = codesters.Rectangle(security.get_x(), 50, security.get_width(), security.get_height()+20, "teal") security_overlay.set_opacity(0.01) comp_overlay = codesters.Rectangle(comp_systems.get_x(), -50, comp_systems.get_width(), comp_systems.get_height()+20, "orange") comp_overlay.set_opacity(0.01) digital_overlay = codesters.Rectangle(dig_cit.get_x(), -150, dig_cit.get_width(), dig_cit.get_height()+20, "yellow") digital_overlay.set_opacity(0.01) # Set boolean values that control when the demo will unpause security_click, computer_click, digital_click = False, False, False # Create rectangles that are needed for the computer systems click, but must be # created now in order to layer properly. side_rect_right = codesters.Rectangle(470, 0, 200, stage_height, "#0097d8") side_rect_right.hide() side_rect_left = codesters.Rectangle(-493, 0, 102, stage_height, "#0097d8") side_rect_left.hide() rects = [side_rect_right, side_rect_left] # Create onscreen text now for the same reason on_stage_text = codesters.Text("", 0, 150, None) on_stage_text.hide() on_stage_text.set_text_width(800) on_stage_text.set_text_size(25) on_stage_text.set_text_background("white", "teal", .75) keep_stage_elements = [gears, security, comp_systems, dig_cit, security_overlay, comp_overlay, digital_overlay, guide, on_stage_text, systems_def, cyber_def] # Create the events associated with each word, and the events to reset the stage between each word def security_text_click(sprite): global security_click, glass security_click = True button = stage_blank() stage.set_background('computerlab_5f8') stage.set_background_scale(1) stage.set_background_x(-545) on_stage_text.show() on_stage_text.set_color("black") on_stage_text.set_text("Security can have many meanings in cybersecurity.\n\n") stage.wait(2) # shatter glass on_stage_text.set_text("Security can have many meanings in cybersecurity.\n\nFirst, the computers must be safe from being stolen or vandalized.") stage.wait(wait_time*3) glass = demo.create_sprite_off_screen("shattered_glass_caa", 0, 100, 4) stage.wait(wait_time*2) button.show() button.event_click(cont_security_function) def cont_security_function(sprite): global glass button = stage_blank() stage.set_background_color("lightblue") on_stage_text.set_text("Security can have many meanings in cybersecurity.\n\nFirst, the computers must be safe from being stolen or vandalized.\n\nSecond, the computers must be safe from unauthorized access!") on_stage_text.show() spy = demo.create_sprite_off_screen("hacker_b1c", -stage_width/3, -1000, 1) spy.glide_to(-stage_width/3, -100) # animate accessing data.. code_editor_backdrop = codesters.Rectangle(100, -100, 505, 205, "chartreuse") code_editor = codesters.Rectangle(100, -100, 500, 200, "black") mini_code_x = -130 mini_code_y = -25 mini_code_step = 25 mini_console_text1 = demo.animate_typing_text('> Accessing personal data...', mini_code_x, mini_code_y, font_size = 17, color = "limegreen", cursor_wait=True) mini_console_text2 = demo.animate_typing_text('> Accessing email...', mini_code_x, mini_code_y-mini_code_step*1, font_size = 17, color = "limegreen", cursor_wait=False) mini_console_text3 = demo.animate_typing_text('> Accessing banking information...', mini_code_x, mini_code_y-mini_code_step*2, font_size = 17, color = "limegreen", cursor_wait=True) mini_console_text4 = demo.animate_typing_text('> Accessing health records...', mini_code_x, mini_code_y-mini_code_step*3, font_size = 17, color = "limegreen", cursor_wait=False) mini_console_text5 = demo.animate_typing_text('> Installing keyloggers...', mini_code_x, mini_code_y-mini_code_step*4, font_size = 17, color = "limegreen", cursor_wait=True) mini_console_text6 = demo.animate_typing_text('> Access Complete!', mini_code_x, mini_code_y-mini_code_step*5, font_size = 17, color = "limegreen", cursor_wait=False) stage.wait(wait_time*1) button.show() button.event_click(ready_click) def computing_click(sprite): global computer_click computer_click = True button = stage_blank() chip_trace.show() stage.set_background_color("#fff7fd") on_stage_text.show() on_stage_text.set_color("black") on_stage_text.set_text("Computing Systems means the computers themselves,\n\n\n\n") computer = demo.create_sprite_off_screen("computer_159", 0, -50, 2) stage.wait(wait_time*2) computer.set_size(.75) computer.move_left(200) stage.wait(wait_time*2) on_stage_text.set_text("Computing Systems means the computers themselves,\n\nand how they accept input, process information, and output results.\n\n") stage.wait(wait_time*2) on_stage_text.set_text("Computing Systems means the computers themselves,\n\nand how they accept input, process information, and output results.\n\nThis also includes how computers get information from,\nand communicate with, other computers.") network = demo.create_sprite_off_screen("network_ef8", 200, -100, 1) computer.set_say_position(0, -175, "absolute") stage.wait(wait_time*1) button.show() button.event_click(ready_click) def dig_cit_click(sprite): global digital_click digital_click = True # side_rect_right = codesters.Rectangle(470, 0, 200, stage_height, "#0097d8") button = stage_blank() stage.set_background("88e4f0a84a844bd3b620f685b07ca63a") stage.set_background_scale(.67) stage.set_background_x(-stage_width/2+100) stage.set_background_y(308) side_rect_left.show() side_rect_right.show() on_stage_text.set_text("Digital Citizenship is all about how people behave online.\n\n\n\n\n\n") on_stage_text.show() stage.wait(wait_time*2) on_stage_text.set_text("Digital Citizenship is all about how people behave online.\n\nJust like there are rules and customs for how people interact in person, there are rules for interacting online!\n\n\n") # friends = demo.create_sprite_off_screen("https://docs.google.com/drawings/d/e/2PACX-1vTiQ_YdKu_rZASvhMeWjL3C6rDEuyu4fgLF7r2G3Vru4aUnOOuEtoaPYmTAq9X_rKodTRP0GSyo3e6J/pub?w=960&h=720", 0, -100, 3) stage.wait(wait_time*3) on_stage_text.set_text("Digital Citizenship is all about how people behave online.\n\nJust like there are rules and customs for how people interact in person, there are rules for interacting online!\n\nThis includes how to stay safe and protect your privacy, follow the laws that regulate interactions online, and be civil online.") stage.wait(wait_time*6) button.show() button.event_click(ready_click) def ready_click(sprite): global security_click, computer_click, digital_click chip_trace.hide() side_rect_right.hide() side_rect_left.hide() sprite.event_click(None) sprite.hide() stage_reset() if security_click and computer_click and digital_click: demo.unpause() def stage_blank(): demo.remove_all_sprites_except(keep_stage_elements+rects+chars+[chip_trace]) stage.event_interval(interval, None) for char in chars: char.set_y_speed(0) char.hide() for element in keep_stage_elements: element.hide() stage.set_background_color("black") text = "Next " + u"⇨" background_sprite = codesters.Circle(545, 0, 200, "#07A7E0") button = demo.create_button(text, 490, 0, True, "white", "#07A7E0", 90, 200, "white") demo.stage.remove_sprite(button.background_sprite) button.background_sprite = background_sprite demo.add_hover_opacity_element(button) button.hide() return button def stage_reset(): global security_click, computer_click, digital_click demo.remove_all_sprites_except(keep_stage_elements+rects+chars+[chip_trace]) stage.set_background_color("black") for element in keep_stage_elements: element.show() on_stage_text.hide() for char in chars: char.set_y_speed(random.randint(-3, -1)) char.show() stage.event_interval(interval, 0.05) if security_click: security.set_color("red") security.show() if computer_click: comp_systems.set_color("yellow") comp_systems.show() if digital_click: dig_cit.set_color("green") dig_cit.show() # Assign click events and pause demo; demo will unpause once all click events have run at least once security_overlay.event_click(security_text_click) comp_overlay.event_click(computing_click) digital_overlay.event_click(dig_cit_click) # gear = demo.create_sprite_off_screen("single_gear_596", -stage_width/2-100, 0, 3) demo.pause() # Create continue button *after* all click events run demo.continue_action() guide.say("") stage.wait(1) guide.move_left(150) guide.say("Great! These are three big parts of cybersecurity.\n\n", 0, "black", 20) stage.wait(2) demo.continue_action() guide.say("Great! These are three big parts of cybersecurity.\nAs we learn more about cybersecurity, we will learn more about\nsecurity, computing systems, and digital citizenship.", 0, "black", 20) stage.wait(2) demo.continue_action() guide.say("In upcoming lessons, you will learn about security and communication!", 0, "black", 20) cyber_def.hide() systems_def.hide() sprite_list = demo.remind_student_to_submit(guide.get_x() - 175, guide.get_y() + 275, 25) for sprite in sprite_list: if sprite.get_name() == 'line' or sprite.get_name() == 'arrowLine': sprite.set_color("white") elif sprite.get_text() != None: sprite.set_color("white") tester = TestManager() tester.display_success_message("Great job!") stage.wait(10) stage.event_interval(interval, None) for char in chars: char.set_y_speed(0)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)